export const customerSourceColumns = context => {
  let tabTypeName
  switch (context.tabType) {
    case '1':
      tabTypeName = '客户来源'
      break
    case '2':
      tabTypeName = '客户行业'
      break
    case '3':
      tabTypeName = '客户类型'
      break
    case '5':
      tabTypeName = '业务场景'
      break
    case '6':
      tabTypeName = '客户名称'
      break
    default:
      tabTypeName = ''
      break
  }
  return [
    {
      prop: 'name',
      renderHead: (h, row) => {
        return <span>{tabTypeName}</span>
      }
    },
    {
      hide: context.tabType !== '6',
      label: '所属行业',
      prop: 'tradeTypeName'
      // render: (h, row) => {
      //   return (
      //     <div>￥{row.tradeType}</div>
      //   )
      // }
    },
    {
      hide: context.tabType !== '6',
      label: '修改时间',
      prop: 'updateTime'
    },
    {
      hide: context.tabType !== '3',
      label: '最低销售金额阈值',
      // prop: 'rental'
      render: (h, row) => {
        return (
          <div>￥{row.rental}</div>
        )
      }
    },
    {
      hide: context.tabType !== '5',
      label: '备注说明',
      prop: 'remark'
    },
    {
      label: '操作',
      width: 160,
      fixed: 'right',
      render: (h, row) => {
        const editBtn = (<el-button type="text" onClick={() => context.onEdit(row)}>
            编辑
        </el-button>)
        const delBtn = (<el-button
          type="text"
          class="text-error"
          disabled={ row.canDel ? row.canDel === '0' : false }
          onClick={() => context.onDelete(row)}
        >
            删除
        </el-button>)
        return ['10', '11', '12'].includes(row.id) ? [editBtn] : [editBtn, delBtn]
      }
    }
  ]
}
export const customerSetColums = (ctx) => {
  return [
    {
      prop: 'name',
      renderHead: (h, row) => {
        return <span>{tabTypeName}</span>
      }
    }
  ]
}
